package com.entmanage.base.collegeco.service.impl;

import java.util.List;
import com.entmanage.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.entmanage.common.utils.SecurityUtils;
import com.entmanage.base.collegeco.mapper.CollegecoInternTaskMapper;
import com.entmanage.base.collegeco.domain.CollegecoInternTask;
import com.entmanage.base.collegeco.service.ICollegecoInternTaskService;

/**
 * 实习生任务书Service业务层处理
 *
 * @author lsq
 * @date 2025-08-06
 */
@Service
public class CollegecoInternTaskServiceImpl implements ICollegecoInternTaskService
{
    @Autowired
    private CollegecoInternTaskMapper collegecoInternTaskMapper;

    /**
     * 查询实习生任务书
     *
     * @param taskId 实习生任务书主键
     * @return 实习生任务书
     */
    @Override
    public CollegecoInternTask selectCollegecoInternTaskByTaskId(Long taskId)
    {
        return collegecoInternTaskMapper.selectCollegecoInternTaskByTaskId(taskId);
    }

    /**
     * 查询实习生任务书列表
     *
     * @param collegecoInternTask 实习生任务书
     * @return 实习生任务书
     */
    @Override
    public List<CollegecoInternTask> selectCollegecoInternTaskList(CollegecoInternTask collegecoInternTask)
    {
        return collegecoInternTaskMapper.selectCollegecoInternTaskList(collegecoInternTask);
    }

    /**
     * 新增实习生任务书
     *
     * @param collegecoInternTask 实习生任务书
     * @return 结果
     */
    @Override
    public int insertCollegecoInternTask(CollegecoInternTask collegecoInternTask)
    {
        // 保存用户和部门id
        collegecoInternTask.setUserId(SecurityUtils.getUserId());
        collegecoInternTask.setDeptId(SecurityUtils.getDeptId());
        collegecoInternTask.setCreateTime(DateUtils.getNowDate());
    collegecoInternTask.setCreateBy(SecurityUtils.getUsername());
        return collegecoInternTaskMapper.insertCollegecoInternTask(collegecoInternTask);
    }

    /**
     * 修改实习生任务书
     *
     * @param collegecoInternTask 实习生任务书
     * @return 结果
     */
    @Override
    public int updateCollegecoInternTask(CollegecoInternTask collegecoInternTask)
    {
        collegecoInternTask.setUpdateTime(DateUtils.getNowDate());
    collegecoInternTask.setUpdateBy(SecurityUtils.getUsername());
        return collegecoInternTaskMapper.updateCollegecoInternTask(collegecoInternTask);
    }

    /**
     * 批量删除实习生任务书
     *
     * @param taskIds 需要删除的实习生任务书主键
     * @return 结果
     */
    @Override
    public int deleteCollegecoInternTaskByTaskIds(Long[] taskIds)
    {
        return collegecoInternTaskMapper.deleteCollegecoInternTaskByTaskIds(taskIds);
    }

    /**
     * 删除实习生任务书信息
     *
     * @param taskId 实习生任务书主键
     * @return 结果
     */
    @Override
    public int deleteCollegecoInternTaskByTaskId(Long taskId)
    {
        return collegecoInternTaskMapper.deleteCollegecoInternTaskByTaskId(taskId);
    }
}
